#include "NPCMessage.h"


NPCMessage::NPCMessage(std::string msg, std::string l, std::string f)
{
	message = msg;
	light = std::atof(l.c_str());
	fight = std::atoi(f.c_str());

}


NPCMessage::~NPCMessage(void)
{
}


std::string NPCMessage::getMessage()
{
	return message;
}

//Transition, not just light
bool NPCMessage::isLight()
{
	if (light != 0)
	{
		return true;
	}
	return false;
}

int NPCMessage::getFight()
{
	return fight;
}

void NPCMessage::checkLight(WindowManager* window, std::string npc, int msgIdx)
{
	if (light != 0)
	{
		sf::Color target = sf::Color::White;
		if (light < 0)
		{
			target = sf::Color::Black;
		}
		window->getBackground()->transition(std::abs(light), target);
	}
}

void NPCMessage::reverseLight(WindowManager* window, std::string npc, int msgIdx)
{
	if (light != 0)
	{
		/*sf::Color target = sf::Color::White;
		if (light < 0)
		{
			target = sf::Color::Black;
		}
		window->getBackground()->transition((-light)/std::abs(light), npc, msgIdx);*/
	}
}


void NPCMessage::setMessage(std::string newMsg)
{
	message = newMsg;
}

float NPCMessage::getLight()
{
	return light;
}